<extend name="public:base"/>

<block name="main">
    <div class="new_promotion">
        <div class="public_box" style="min-height: 675px;">
            <div class="title">团队详情 [<a href="{:url('user/promote/index')}">返回</a>]</div>
            <div class="contents">

                <div class="cl l28">
                    <div class="dateSearch fl">
                        <form action="{:url('user/promote/friends')}" method="get" class="searchForm">
                            <input type="text" name="start" id="startTime" class="text"
                                   value="{$where.start|default=''}"
                                   data-date="" data-format="mm-yyyy" data-start-view="year" data-min-view="year"/>
                            <input type="submit" class="confirm" value="查&nbsp;看"/>
                        </form>
                    </div>
                    <div class="fr a666">
                        <span class="pl20">累计团队人数：<i class="af60">{$total_friend|default='0.00'}</i>人</span>
                        <span class="pl20">投资人数：<i class="af60">{$total_invest_count|default='0.00'}</i>人</span>
                        <span class="pl20">累计贡献奖励：<i
                                class="af60">{$total_contribution_amount|default='0.00'}</i>元</span>
                    </div>
                </div>
                <div class="cl mt30">

                    <table cellspacing="0" cellpadding="0" border="0" class="tableBorder mt10">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>用户手机</th>
                            <th>注册时间</th>
                            <th>投资次数</th>
                            <th>最近投资时间</th>
                            <th>贡献返佣(元)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <notempty name="friend_list">
                            <volist name="friend_list" id="v" key="i">
                                <tr>
                                    <td>{$v.sort}</td>
                                    <td>{$v.phone}</td>
                                    <td>{$v.reg_time|date="Y-m-d",###}</td>
                                    <td>{$v.invest_count}</td>
                                    <td>
                                        <if condition="$v.last_invest_time">{$v.last_invest_time|date="Y-m-d",###}
                                            <else/>
                                            --
                                        </if>
                                    </td>
                                    <td>{$v.contribution_amount}</td>
                                    <td>{$v.recommend_count}</td>

                                </tr>
                            </volist>
                            <else/>
                            <tr>
                                <td colspan="9"><p class="tc a999 pt30 pb30">您还未邀请好友，快召唤小伙伴一起赚起来吧!</p></td>
                            </tr>
                        </notempty>
                        </tbody>
                    </table>
                    <!--<p class="a999 pt20">*红包发送规则：用户可给您的好友发放红包，金额随机（每周同一个好友限发1个）；</p>-->
                </div>
            </div>
        </div>
    </div>
</block>

<block name="js">

    <!-- 日历插件 -->
    <link rel="stylesheet" href="https://www.jq22.com/jquery/font-awesome.4.6.0.css">
    <link rel="stylesheet" href="__PUBLIC__/js/datepicker/css/foundation-datepicker.css">
    <script src="__PUBLIC__/js/datepicker/js/foundation-datepicker.js"></script>
    <script src="__PUBLIC__/js/datepicker/js/locales/foundation-datepicker.zh-CN.js"></script>
    <script type="text/javascript">
        $('#startTime').fdatepicker({
            format: 'yyyy-mm', pickTime: true
        });

        $(".send_redPacker").click(function () {
            var id = $(this).attr("data-id"), user_name = $(this).attr("data-name");
            if (!id) return false;
            layer.confirm('您确定要给好友' + user_name + '发送红包吗？', {
                btn: ['确定', '取消']
            }, function () {
                $.post("{:url('uc/promotion/send_card')}", {friend_id: id.toString()}, function (data) {
                    if (data.code === 1) {
                        layer.alert(data.msg, {icon: 1, title: '温馨提醒'});
                        $(this).prop("disabled", true).addClass("not");
                    } else {
                        layer.alert(data.msg, {icon: 2, title: '温馨提醒'});
                        $(this).prop("disabled", false).removeClass("not");
                    }
                }, "json");
            });

        });
    </script>
</block>